<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	session.setAttribute("basePath", basePath);
%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<base href="${basePath }">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="description" content="">
<meta name="author" content="">
<title>西普茗茶商品-个人中心</title>
<meta name="renderer" content="webkit">

<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="https://cdn.bootcss.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN PAGE LEVEL STYLES -->
<!-- END PAGE LEVEL STYLES -->
<!-- BEGIN THEME STYLES -->
<link href="assets/css/style-metronic.css" rel="stylesheet" type="text/css" />
<link href="assets/css/style.css" rel="stylesheet" type="text/css" />
<link href="assets/css/style-responsive.css" rel="stylesheet" type="text/css" />
<link href="assets/css/themes/light.css" rel="stylesheet" type="text/css" id="style_color" />
<link href="assets/css/custom.css" rel="stylesheet" type="text/css" />
<link href="assets/css/pages/blog.css" rel="stylesheet" type="text/css" />
<link href="css/iconfont.css" rel="stylesheet" type="text/css" />
<!-- END THEME STYLES -->
<link rel="shortcut icon" href="favicon.ico" />

<script type="text/javascript">
	var isHTML5 = true;
</script>
<!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
	<script src="js/excanvas.min.js"></script> 
    <script type="text/javascript">
		isHTML5 = false;
	</script>
<![endif]-->
<style type="text/css">
body {
	background: #fef9f3 !important;
}
</style>
</head>
<!--/head-->
<!-- BEGIN BODY -->
<body class="page-footer-fixed">
	<!-- BEGIN HEADER -->
	<div class="header navbar">
		<div class="container-fluid">
			<div class="row">
				<div class="col-xs-2 text-center">
					<a href="./" class="icon_a_link">
						<i style="font-size: 24px; line-height: 40px; height: 40px;" class="iconfont icon-qh-home text-gold">&#xe61a;</i>
					</a>
				</div>
				<div class="col-xs-8 text-center">
					<h4>个人中心</h4>
				</div>
				<div class="col-xs-2 text-center"></div>
			</div>
		</div>
	</div>
	<!-- END HEADER -->
	<div class="clearfix "></div>
	<!-- BEGIN CONTAINER -->
	<div class="page-container">

		<!-- BEGIN CONTENT -->
		<div class="page-content-wrapper">
			<div class="page-content no-space" style="margin-bottom: 50px !important; border-bottom: none !important; background: transparent !important;">
				<div class="well well-sm margin-bottom-10">
					<div class="blog-page no-space">
						<div class="container">
							<div class="row">
								<div class="col-xs-12" id="buyer_info_click_div">
									<div class="media">
										<a href="javascript:void(0)" class="pull-left">
											<c:choose>
												<c:when test="${buyerSession.buyerHeadimgurl!=null }">
													<img alt="" src="${buyerSession.buyerHeadimgurl}" class="media-object" style="border-radius: 6px !important;">
												</c:when>
												<c:otherwise>
													<img alt="" src="images/buyer_default_head_img.jpg" class="media-object" style="border-radius: 6px !important;">
												</c:otherwise>
											</c:choose>

										</a>
										<div class="media-body padding-top-5">
											<c:choose>
												<c:when test="${buyerSession.buyerType!=null&&buyerSession.buyerType!=''&&buyerSession.buyerType!='普通买家'}">
													<i class="fa fa-angle-right pull-right text-light" style="font-size: 30px; margin-top: 15px;"></i>
													<div style="display: none;" id="could_show_qrcode"></div>
												</c:when>
											</c:choose>
											<h5 class="media-heading">
												<c:choose>
													<c:when test="${buyerSession.buyerName!=null }">
														<span><strong>${buyerSession.buyerName }</strong></span>
													</c:when>
													<c:otherwise>
														<span><strong>${buyerSession.buyerNickname}</strong></span>
													</c:otherwise>
												</c:choose>
												<!-- <span class="text-light">（推荐人：西普茗茶）</span> -->
											</h5>
											<p class="margin-top-10">
												<span class="text-light">地区：</span><span class="text-red"><strong>${buyerSession.buyerCountry }&nbsp;${buyerSession.buyerProvince }&nbsp;${buyerSession.buyerCity }</strong></span>
											</p>
											<div class="clearfix"></div>
										</div>
									</div>
								</div>
							</div>
						</div>
						<hr style="margin-top: 10px !important; margin-bottom: 10px !important;">
						<div class="container">
							<div class="row">
								<div class="col-xs-3 text-right">
									<i style="font-size: 30px; line-height: 40px; height: 40px;" class="iconfont icon-qh-coupon-2 text-gold">&#xe645;</i>
								</div>
								<div class="col-xs-3 text-left" style="border-right: 1px solid #ccc;">
									<a href="show_buyer_coupon_list?s=未使用" class="icon-btn">
										<span class="text-red"><strong id="coupon_icon_number">0</strong></span>
										<div>优惠券</div>
									</a>
								</div>
								<div class="col-xs-3 text-right">
									<i style="font-size: 30px; line-height: 40px; height: 40px;" class="iconfont icon-qh-coin text-gold">&#xe644;</i>
								</div>
								<div class="col-xs-3 text-left">
									<a href="javascript:void(0)" class="icon-btn">
										<span class="text-red"><strong>${buyerSession.buyerPoints }</strong></span>
										<div>积分</div>
									</a>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="well well-sm margin-top-10 margin-bottom-0">
					<div class="blog-page no-space">
						<div class="container">
							<div class="row">
								<div class="col-xs-3 text-center" style="border-right: 1px solid #ccc;">
									<a href="show_order_list?s=待付款" class="icon-btn">
										<i style="font-size: 22px;" class="iconfont icon-qh-wallet text-gold">&#xe641;</i>
										<div>待付款</div>
										<span class="badge badge-important order_need_load_badge" data-url="u_get_order_number?s=待付款" id="to_be_payed_icon_number"></span>
									</a>
								</div>
								<div class="col-xs-3 text-center" style="border-right: 1px solid #ccc;">
									<a href="show_order_list?s=待发货" class="icon-btn">
										<i style="font-size: 22px;" class="iconfont icon-qh-package text-gold">&#xe640;</i>
										<div>待发货</div>
										<span class="badge badge-important order_need_load_badge" data-url="u_get_order_number?s=待发货" id="to_be_send_icon_number"></span>
									</a>
								</div>
								<div class="col-xs-3 text-center" style="border-right: 1px solid #ccc;">
									<a href="show_order_list?s=待收货" class="icon-btn">
										<i style="font-size: 22px;" class="iconfont icon-qh-car text-gold">&#xe643;</i>
										<div>待收货</div>
										<span class="badge badge-important order_need_load_badge" data-url="u_get_order_number?s=待收货" id="to_be_received_icon_number"></span>
									</a>
								</div>
								<div class="col-xs-3 text-center">
									<a href="show_order_list?s=待评价" class="icon-btn">
										<i style="font-size: 22px;" class="iconfont icon-qh-heart text-gold">&#xe642;</i>
										<div>待评价</div>
										<span class="badge badge-important order_need_load_badge" data-url="u_get_order_number?s=待评价" id="to_be_commented_icon_number"></span>
									</a>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="list-group">
					<a href="show_order_list" class="list-group-item" style="border-top: none;">
						<i style="font-size: 22px;" class="iconfont icon-qh-detail text-gold">&#xe62a;</i> 全部订单 <i class="fa text-gold fa-angle-right pull-right text-light" style="font-size: 30px;"></i>
					</a>
				</div>

				<c:choose>
					<c:when test="${buyerSession.buyerType!=null&&buyerSession.buyerType!=''&&buyerSession.buyerType!='普通买家'}">
						<div class="list-group">
							<a href="show_my_commission" class="list-group-item">
								<i style="font-size: 22px;" class="iconfont icon-qh-commission text-gold">&#xe649;</i> 我的佣金 <i class="fa text-gold fa-angle-right pull-right text-light" style="font-size: 30px;"></i>
							</a>
							<a href="show_my_pre_commission" class="list-group-item">
								<i style="font-size: 22px;" class="iconfont icon-qh-commission text-gold">&#xe649;</i> 我的预测佣金 <i class="fa text-gold fa-angle-right pull-right text-light" style="font-size: 30px;"></i>
							</a>
						</div>
					</c:when>
				</c:choose>

				<div class="list-group">
					<a href="cart" class="list-group-item">
						<i style="font-size: 22px;" class="iconfont icon-qh-cart text-gold">&#xe61b;</i> 我的购物车 <i class="fa text-gold fa-angle-right pull-right text-light" style="font-size: 30px;"></i>
					</a>
					<a href="show_collection_list" class="list-group-item">
						<i style="font-size: 22px;" class="iconfont icon-qh-collect text-gold">&#xe61c;</i> 我的收藏 <i class="fa text-gold fa-angle-right pull-right text-light" style="font-size: 30px;"></i> <span
							class="badge badge-danger buyer_collection_icon_number"></span>
					</a>
					<a href="show_buyer_coupon_list?s=未使用" class="list-group-item">
						<i style="font-size: 22px;" class="iconfont icon-qh-coupon text-gold">&#xe646;</i> 我的优惠券 <i class="fa text-gold fa-angle-right pull-right text-light" style="font-size: 30px;"></i>
					</a>
					<a href="show_buyer_comment_list" class="list-group-item">
						<i style="font-size: 22px;" class="iconfont icon-qh-heart text-gold">&#xe642;</i> 我的评价晒单 <i class="fa text-gold fa-angle-right pull-right text-light" style="font-size: 30px;"></i>
					</a>
					<a href="show_could_apply_return_order_list" class="list-group-item">
						<i style="font-size: 22px;" class="iconfont icon-qh-return text-gold">&#xe63c;</i> 我的退换货 <i class="fa text-gold fa-angle-right pull-right text-light" style="font-size: 30px;"></i>
					</a>
					<a href="show_browser_history_list" class="list-group-item">
						<i style="font-size: 22px;" class="iconfont icon-qh-history text-gold">&#xe630;</i> 我的浏览记录 <i class="fa text-gold fa-angle-right pull-right text-light" style="font-size: 30px;"></i>
					</a>
					<a href="show_buyer_message_list" class="list-group-item">
						<i style="font-size: 22px;" class="iconfont icon-qh-contact text-gold">&#xe621;</i> 我的留言中心 <i class="fa text-gold fa-angle-right pull-right text-light" style="font-size: 30px;"></i>
					</a>
					<a href="show_buyer_address_list" class="list-group-item">
						<i style="font-size: 22px;" class="iconfont icon-qh-address text-gold">&#xe63e;</i> 收货地址管理 <i class="fa text-gold fa-angle-right pull-right text-light" style="font-size: 30px;"></i>
					</a>
					<a href="help_list" class="list-group-item">
						<i style="font-size: 22px;" class="iconfont icon-qh-help text-gold">&#xe63f;</i> 帮助中心 <i class="fa text-gold fa-angle-right pull-right text-light" style="font-size: 30px;"></i>
					</a>
				</div>
			</div>
			<!-- END CONTAINER -->
		</div>
	</div>

	<!-- BEGIN FOOTER -->
	<div class="footer">
		<div class="container">
			<div class="row">
				<div class="col-xs-3 text-center">
					<a href="./" class="icon-btn">
						<!-- <i class="fa fa-home text-gold"></i> -->
						<i style="font-size: 22px;" class="iconfont text-gold icon-qh-logo">&#xe626;</i>
						<div class="text-gold margin-top-2">首页</div>

					</a>
				</div>
				<div class="col-xs-3 text-center">
					<a href="goods_type/get_shop_goods_type" class="icon-btn">
						<!-- <i class="fa fa-list-ul text-gold"></i> -->
						<i style="font-size: 22px;" class="iconfont text-gold con-qh-all-goods">&#xe622;</i>
						<div class="text-gold margin-top-2">类型</div>
					</a>
				</div>
				<div class="col-xs-3 text-center">
					<a href="cart" class="icon-btn">
						<!-- <i class="fa fa-shopping-cart text-gold"></i> -->
						<i style="font-size: 22px;" class="iconfont text-gold icon-qh-cart">&#xe61b;</i>
						<div class="text-gold margin-top-2">购物车</div>

						<span class="badge badge-important" id="shooping_cart_icon_number"></span>
					</a>
				</div>
				<div class="col-xs-3 text-center">
					<a href="item/infocenter.jsp" class="icon-btn">
						<!-- <i class="fa fa-user text-gold"></i> -->
						<i style="font-size: 22px;" class="iconfont text-gold icon-qh-infocenter">&#xe61d;</i>
						<div class="text-gold margin-top-2">个人中心</div>
					</a>
				</div>
			</div>
		</div>
	</div>
	<!-- END FOOTER -->
	<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
	<!-- BEGIN CORE PLUGINS -->
	<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
	<script src="https://cdn.bootcss.com/jquery-migrate/1.2.1/jquery-migrate.min.js" type="text/javascript"></script>
	<!-- IMPORTANT! Load jquery-ui-1.10.3.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
	<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" type="text/javascript"></script>
	<!-- END CORE PLUGINS -->
	<!-- BEGIN PAGE LEVEL PLUGINS -->
	<!-- END PAGE LEVEL PLUGINS -->
	<!-- BEGIN PAGE LEVEL SCRIPTS -->
	<script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<!-- END PAGE LEVEL SCRIPTS -->

	<script>
		$(function()
		{
			$("#buyer_info_click_div").click(function()
			{
				if ($("#could_show_qrcode").length > 0)
				{
					window.location.href = "show_buyer_qrcode";
				}
			});

			//设置数量
			if ($(".order_need_load_badge").length > 0)
			{
				$(".order_need_load_badge").each(function()
				{
					var obj = $(this);
					$.post(obj.attr("data-url"), {}, function(json)
					{
						if (json.success == true)
						{
							obj.fadeOut(100, function()
							{
								if (json.numberchange < 100)
								{
									obj.html(json.numberchange).fadeIn(100);
								}
								else
								{
									obj.html("99+").fadeIn(100);
								}
							});
						}
					},
					//返回类型
					"json");
				});
			}
			if ($("#coupon_icon_number").length > 0)
			{
				var obj = $("#coupon_icon_number");
				$.post("u_get_coupon_number?s=未使用", {}, function(json)
				{
					if (json.success == true)
					{
						obj.fadeOut(100, function()
						{
							if (json.numberchange < 100)
							{
								obj.html(json.numberchange).fadeIn(100);
							}
							else
							{
								obj.html("99+").fadeIn(100);
							}
						});
					}
				},
				//返回类型
				"json");
			}

			$.post("wc_get_wechat_info",
			{
				"currentUrl" : location.href.split('#')[0]
			}, function(json)
			{
				wx.config(
				{
					debug : false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
					appId : json.appId, // 必填，公众号的唯一标识
					timestamp : json.timestamp, // 必填，生成签名的时间戳
					nonceStr : json.nonceStr, // 必填，生成签名的随机串
					signature : json.signature,// 必填，签名，见附录1
					jsApiList : [ 'onMenuShareTimeline', 'chooseWXPay' ]
				// 必填，需要使用的JS接口列表，所有JS接口列表见附录2
				});
				wx.ready(function()
				{

					$("#wx_kf").click(function()
					{
						$.post("u_wx_create_customservice_do", {}, function(return_json)
						{
							if (return_json.success == true)
							{
								wx.closeWindow();
							}
						},
						//返回类型
						"json");
					});

				});
				wx.error(function(res)
				{
				});

				if ("${buyerSession.buyerId}".length <= 0)
				{
					var code = "${param.code}";
					if (code.length > 0)
					{
						$.post("wc_get_user_info",
						{
							'code' : code
						}, function(return_json)
						{
							if (return_json.success == true)
							{
								//alert("openid(getUserInfo):" + return_json.openid);
								//window.location.href = location.href.split('#')[0];
							}
						},
						//返回类型
						"json");
					}
					else
					{
						$.post("wc_valid_have_this_person", {}, function(valid_json)
						{
							if (valid_json.success == false)
							{

								var authUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect";

								authUrl = authUrl.replace("APPID", json.appId);
								authUrl = authUrl.replace("REDIRECT_URI", location.href.split('#')[0]);
								authUrl = authUrl.replace("SCOPE", "snsapi_base");
								authUrl = authUrl.replace("STATE", 1);
								window.location.href = authUrl;
							}
							else
							{
								//alert("openid(validHaveThisPerson):" + valid_json.openid);
							}
						},
						//返回类型
						"json");
					}
				}
			},
			//返回类型
			"json");

			//设置购物车购物数量
			if ($("#shooping_cart_icon_number").length > 0)
			{
				$.post('u_get_shoppingcar_number', {}, function(json)
				{
					if (json.success == true)
					{
						$("#shooping_cart_icon_number").fadeOut(100, function()
						{
							if (json.numberchange < 100)
							{
								$("#shooping_cart_icon_number").html(json.numberchange).fadeIn(100);
							}
							else
							{
								$("#shooping_cart_icon_number").html("99+").fadeIn(100);
							}
						});
					}
				},
				//返回类型
				"json");
			}
		});
	</script>
	<!-- END JAVASCRIPTS -->
</body>
</html>